/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package exatrez.model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Mansur
 */
@Entity
@Table(name = "ship_visit3_sub")
@NamedQueries({
    @NamedQuery(name = "ShipVisit3Sub.findAll", query = "SELECT s FROM ShipVisit3Sub s")})
public class ShipVisit3Sub implements Serializable{
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ship_visit3s_id")
    private Integer shipVisit3SubId;
    
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "ship_visit3_id")
    private ShipVisit3 shipVisit3;
    
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "ref_sh_id")
    private RefShipVisitHeader refShipVisitHeader;
    
    @Column(name = "details")
    private String details;
    
    @Column(name = "input_type")
    private String inputType;  // S=Single Line, M=Multiple Line
    
    @Embedded
    private InfoAudit infoAudit;
    
    @OneToMany (mappedBy = "shipVisit3Sub" , fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    private List<ShipVisit3SubExtend> listSV3SubExtend;
    
    public ShipVisit3Sub(){
        
    }

    public Integer getShipVisit3SubId() {
        return shipVisit3SubId;
    }

    public void setShipVisit3SubId(Integer shipVisit3SubId) {
        this.shipVisit3SubId = shipVisit3SubId;
    }

    public ShipVisit3 getShipVisit3() {
        return shipVisit3;
    }

    public void setShipVisit3(ShipVisit3 shipVisit3) {
        this.shipVisit3 = shipVisit3;
    }

    public RefShipVisitHeader getRefShipVisitHeader() {
        return refShipVisitHeader;
    }

    public void setRefShipVisitHeader(RefShipVisitHeader refShipVisitHeader) {
        this.refShipVisitHeader = refShipVisitHeader;
    }

    public String getDetails() {
        return details;
    }

    public void setDetails(String details) {
        this.details = details;
    }

    public String getInputType() {
        return inputType;
    }

    public void setInputType(String inputType) {
        this.inputType = inputType;
    }

    public InfoAudit getInfoAudit() {
        return infoAudit;
    }

    public void setInfoAudit(InfoAudit infoAudit) {
        this.infoAudit = infoAudit;
    }

    public List<ShipVisit3SubExtend> getListSV3SubExtend() {
        return listSV3SubExtend;
    }

    public void setListSV3SubExtend(List<ShipVisit3SubExtend> listSV3SubExtend) {
        this.listSV3SubExtend = listSV3SubExtend;
    }
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (shipVisit3SubId != null ? shipVisit3SubId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ShipVisit3Sub)) {
            return false;
        }
        ShipVisit3Sub other = (ShipVisit3Sub) object;
        if ((this.shipVisit3SubId == null && other.shipVisit3SubId != null) || (this.shipVisit3SubId != null && !this.shipVisit3SubId.equals(other.shipVisit3SubId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "exatrez.model.ShipVisit3Sub[ shipVisit3SubId=" + shipVisit3SubId + " ]";
    }
    
}
